package it.tukano.treditor.resources;

import it.tukano.collections.MapExt;
import java.util.EnumMap;

public class Labels {

    private static Labels INSTANCE = new Labels();

    public static Labels getInstance() {
        return INSTANCE;
    }

    public static enum LabelKey {

        NO_KEY,
        ADD, DIRECTIONAL_LIGHT, NODE, NEW_NODE_NAME, POSX, POSY, POSZ,
        ROTX, ROTY, ROTZ, POSITION, ORIENTATION, VIEW_FORM_TITLE,
        DEFAULT_VIEW_NAME, FILE, NEW, OPEN, SAVE, SAVE_AS, EXPORT, DEFAULT_SCENE_ROOT_NAME,
        NEW_SCENE_CONFIRM, CONFIRM, MAIN_FRAME_TITLE, ENGINE_DISPLAY_NAME, SCENE_GRAPH_VIEWER_TITLE,
        TREDITOR_FILE_DESCRIPTION, TREDITOR_FILE_WRITTEN, TREDITOR_FILE_WRITE_FAILURE, ROTATION,
        MODEL_FORM_TITLE, SCALEX, SCALEY, SCALEZ, SCALE, DIRX, DIRY, DIRZ, LIGHT_COLOR, DIRECTION,
        DIRECTIONAL_LIGHT_SETTINGS, REMOVE, CONSOLE, GRIDS, XY_GRID, YZ_GRID, XZ_GRID, LOOK_AT,
        TOOLBAR }
    private final MapExt<LabelKey, String> map = MapExt.newInstance(new EnumMap<LabelKey, String>(LabelKey.class)).putAll(LabelKey.class, String.class,
            LabelKey.ADD, "Add",
            LabelKey.DIRECTIONAL_LIGHT, "Directional Light",
            LabelKey.NODE, "Node",
            LabelKey.NEW_NODE_NAME, "Unnamed",
            LabelKey.POSX, "Pos X",
            LabelKey.POSY, "Pos Y",
            LabelKey.POSZ, "Pos Z",
            LabelKey.ROTX, "Rot X",
            LabelKey.ROTY, "Rot Y",
            LabelKey.ROTZ, "Rot Z",
            LabelKey.POSITION, "Position",
            LabelKey.ORIENTATION, "Orientation",
            LabelKey.VIEW_FORM_TITLE, "View",
            LabelKey.DEFAULT_VIEW_NAME, "Default View",
            LabelKey.FILE, "File",
            LabelKey.NEW, "New",
            LabelKey.SAVE, "Save",
            LabelKey.OPEN, "Open",
            LabelKey.SAVE_AS, "Save as...",
            LabelKey.EXPORT, "Export...",
            LabelKey.DEFAULT_SCENE_ROOT_NAME, "Scene Root",
            LabelKey.NEW_SCENE_CONFIRM, "Current scene will be lost. Confirm?",
            LabelKey.CONFIRM, "Confirm",
            LabelKey.MAIN_FRAME_TITLE, "3dtor - Main Frame",
            LabelKey.ENGINE_DISPLAY_NAME, "Engine Display",
            LabelKey.SCENE_GRAPH_VIEWER_TITLE, "Scenegraph",
            LabelKey.TREDITOR_FILE_DESCRIPTION, "3dtor file",
            LabelKey.TREDITOR_FILE_WRITTEN, "3dtor file successfully written.",
            LabelKey.TREDITOR_FILE_WRITE_FAILURE, "3dtor file write failed.",
            LabelKey.ROTATION, "Rotation",
            LabelKey.MODEL_FORM_TITLE, "Model Properties",
            LabelKey.SCALEX, "Scale X",
            LabelKey.SCALEY, "Scale Y",
            LabelKey.SCALEZ, "Scale Z",
            LabelKey.SCALE, "Scale",
            LabelKey.DIRX, "Dir X",
            LabelKey.DIRY, "Dir Y",
            LabelKey.DIRZ, "Dir Z",
            LabelKey.LIGHT_COLOR, "Light's Color",
            LabelKey.DIRECTION, "Direction",
            LabelKey.DIRECTIONAL_LIGHT_SETTINGS, "Directional Light Settings",
            LabelKey.REMOVE, "Remove",
            LabelKey.CONSOLE, "Console",
            LabelKey.GRIDS, "Grids",
            LabelKey.XY_GRID, "XY",
            LabelKey.YZ_GRID, "YZ",
            LabelKey.XZ_GRID, "XZ",
            LabelKey.LOOK_AT, "Look At",
            LabelKey.TOOLBAR, "Tools");

    public String getLabelValue(LabelKey key) {
        return map.getOrElse(key, "MISSING:" + key);
    }

    public LabelKey getLabelKey(String labelValue) {
        return map.findKeyOrElse(labelValue, LabelKey.NO_KEY);
    }
}
